<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <div id="home">
            <span>首页</span>
            <lk-box :msg="'Baidu'" :array="['广告', '搜索']"></lk-box>
        </div>

        <div id="msg">
            <span>消息</span>
            <lk-box :msg="'Bilibili'" :array="['视频', '学习']"></lk-box>
        </div>

        <div id="mine">
            <span>我的</span>
            <lk-box :msg="'Google'" :array="['广告', '学习', '搜索']"></lk-box>
        </div>
    </div>

    <template id="box">
        <p>------------------------</p>
        <p>{{msg}}</p>
        <ul>
            <li v-for=" msg in array"> {{msg}} </li>
        </ul>
        <p>------------------------</p>
    </template>

    <script src="js/vue.js"></script>
    <script>
        const Box = {
            template: `#box`,
            props:['msg', 'array']
        };

        // 如果是将 data 设置为 obj 的话，在控制台中会报错
        const app = Vue.createApp({
            data() {
                return {
                    msg: "测试",
                    msgArray: ['测试', 'Web', 'Java', 'Python', 'Go']
                }
            },
            components: {
                "lk-box": Box
            }
        }).mount("#app");

    </script>
</body>

</html>
